OBJS := start.o main.o boot.o dev/dev.o lib/lib.o net/net.o
CFLAGS := -fno-builtin -I$(shell pwd)/include 
export CFLAGS

ice-boot.bin : ice-boot.elf
	arm-linux-objcopy -O binary $^ $@
	
ice-boot.elf : $(OBJS)
	arm-linux-ld -Tice-boot.lds -o $@ $^
	
%.o : %.S
	arm-linux-gcc -g -c $^ -o $@
	
%.o : %.c
	arm-linux-gcc -g -c $(CFLAGS) $^ -o $@

dev/dev.o:
	make -C dev all

net/net.o:
	make -C net all
		
lib/lib.o:
	make -C lib all

	
.PHONY: clean
clean:
	rm *.o *.bin *.elf
	make -C dev clean
	make -C net clean
	make -C lib clean
	
